/**
 * Copyright 2010-present Facebook.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.twodstar.photobattle;


import com.facebook.widget.ProfilePictureView;
import com.nostra13.universalimageloader.cache.disc.impl.TotalSizeLimitedDiscCache;
import com.nostra13.universalimageloader.core.DisplayImageOptions;
import com.nostra13.universalimageloader.core.ImageLoader;
import com.nostra13.universalimageloader.core.ImageLoaderConfiguration;

import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.util.Log;
import android.view.View;
import android.widget.Advanceable;
import android.widget.ArrayAdapter;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.ProgressBar;
import android.widget.TextView;


/**
 * Base class for a list element in the Scrumptious main display, consisting of an
 * icon to the left, and a two line display to the right.
 */
public class Element_BestList 
{
	private Activity m_Activity;
    private BaseAdapter adapter;
    
	private String m_FBID;
	private String m_Name;
	private String m_Title;
	private int m_Level;
	private int m_BattleTotal;
	private int m_BattleWin;
    
	private ProfilePictureView m_ProfilePic;
    private TextView m_TextView_Name;
    private TextView m_TextView_Title;
    private TextView m_TextView_Level;
    private TextView m_TextView_Battle;
    
    
   
    public Element_BestList(	 	Activity PActivity, 
		    					String FBID,
								String Name,
								String Title,
								int Level,
								int BattleTotal,
								int BattleWin
    						) 
    {
    	m_Activity = PActivity;
    	
    	m_FBID = FBID;
    	m_Name = Name;
    	m_Title = Title;
    	m_Level = Level;
    	m_BattleTotal = BattleTotal;
    	m_BattleWin = BattleWin;
       
    }
    
    public void SetViewElements( 	ProfilePictureView ProfilePic,
								    TextView TextView_Name,
								    TextView TextView_Title,
								    TextView TextView_Level,
								    TextView TextView_Battle)
    {
    	//Log.i("game", "SetViewElements-----------------");
    	
    	m_ProfilePic = ProfilePic;
        m_TextView_Name = TextView_Name;
        m_TextView_Title = TextView_Title;
        m_TextView_Level = TextView_Level;
        m_TextView_Battle = TextView_Battle;
        
        if(m_ProfilePic != null)
        	m_ProfilePic.setProfileId(m_FBID);
        
        if(m_TextView_Name != null)
        	m_TextView_Name.setText(m_Name);
        
        if(m_TextView_Title != null)
        	m_TextView_Title.setText("Title: " + m_Title);
        
        if(m_TextView_Level != null)
        	m_TextView_Level.setText("Level: " + m_Level);
        
        if(m_TextView_Battle != null)
        	m_TextView_Battle.setText("Battles: " + m_BattleWin + "/" + m_BattleTotal);
        
    }

    /**
     * The Adapter associated with this list element (used for notifying that the
     * underlying dataset has changed).
     * @param adapter the adapter associated with this element
     */
    public void setAdapter(BaseAdapter padapter) 
    {
        this.adapter = padapter;
    }
    
    public BaseAdapter getAdapter() 
    {
        return this.adapter;
    }
       
     
    protected void notifyDataChanged() 
    {
    	if(adapter != null)
    		adapter.notifyDataSetChanged();
    }
    
    
}
